<?php
/**
* 主站：选油路由
*
* 说明：type 可选值[enum,number,enumber,string,estring,date]
*		type == enum 时，可设置 [options,min,max]
* @author     Robot
* @version    1.0
* @copyright  商业软件,受著作权保护
*/

######################################## 以下是路由部分 ##########################################

/*
---------------------------------------------------------------------
- 功能描述: 主站泛解析路由表
- 版本: 1.0
- 原作者:Robot
- 编写日期:2014/9/2
- 运行环境:---
---------------------------------------------------------------------
*/
class Router extends Base
{
	public $rule = array();

	/**
	 * 构造函数
	 *
	 * @access public
	 * @param
	 * @return void
	 */
	function __construct($rule)
	{
		//设置规则
		$this->rule = $rule;

		//不是小写，重定向到小写
		$request_lower = strtolower($_SERVER['REQUEST_URI']);
		if($request_lower != $_SERVER['REQUEST_URI'])
		{
			Common::header($request_lower);
			exit;
		}

		//去除sessionid字符串
		if(substr($request_lower, 0, 2) == '/?')
		{
			$request_lower = preg_replace("/\?(.+)/", "", $request_lower);
			Common::header($request_lower);
			exit;
		}

		parent::$channel = "www";

		//www首页
		if($request_lower == '/')
		{
			parent::$controller = "home";
			parent::$action = "index";
		}

		//选油-填写参数
		else if($request_lower == '/start.html')
		{
			parent::$controller = "home";
			parent::$action = "start";
		}

		//选油-有结果
		else if(substr($request_lower, 0, 12) == '/starty.html')
		{
			parent::$controller = "home";
			parent::$action = "starty";
		}

		//选油-无结果
		else if(substr($request_lower, 0, 12) == '/startn.html')
		{
			parent::$controller = "home";
			parent::$action = "startn";
		}

		//寻求帮助
		else if(substr($request_lower, 0, 20) == '/callspecialist.html')
		{
			parent::$controller = "home";
			parent::$action = "callspecialist";
		}

		//反馈
		else if($request_lower == '/yijian.html')
		{
			parent::$controller = "home";
			parent::$action = "yijian";
		}
		//反馈
		else if($request_lower == '/first.html')
		{
			parent::$controller = "home";
			parent::$action = "first";
		}
		else if($request_lower == '/start_1.html')
		{
			parent::$controller = "home";
			parent::$action = "startone";
		}
		else if($request_lower == '/start_2.html')
		{
			parent::$controller = "home";
			parent::$action = "startTwo";
		}
		else if($request_lower == '/start_3.html')
		{
			parent::$controller = "home";
			parent::$action = "startThree";
		}
		else if($request_lower == '/start_4.html')
		{
			parent::$controller = "home";
			parent::$action = "startFour";
		}
		else if($request_lower == '/start_5.html')
		{
			parent::$controller = "home";
			parent::$action = "startFive";
		}
		else if($request_lower == '/start_6.html')
		{
			parent::$controller = "home";
			parent::$action = "startSix";
		}
		else if(substr($request_lower, 0, 14) == '/find_err.html')
		{
			parent::$controller = "home";
			parent::$action = "findErr";
		}
		else
		{
			Common::header("/");
		}
	}
}
?>
